﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    class BaoDong
    {
        public char[] chrThuocTinh;
        public int intSoThuocTinh;
        public BaoDong()
        {
            chrThuocTinh = new char [30];
            intSoThuocTinh = 0;
        }
        public void add(char temp)
        {
            this.chrThuocTinh[intSoThuocTinh++] = temp;
        }
        public void AddChuoi(string temp)
        {
            for (int i = 0; i < temp.Length; i++)
            {
                this.add(temp[i]);
            }
        }
        public bool KiemTra(BaoDong moi)
        {
            for (int i = 0; i < moi.intSoThuocTinh; i++)
            {
                if (this.chrThuocTinh.Contains(moi.chrThuocTinh[i]) == false)
                    return false;
            }
            return true;
        }
        
        public bool CheckLap()
        {
            for (int i = 1; i < this.intSoThuocTinh; i++)
                for (int j = 0; j < i; j++)
                    if (this.chrThuocTinh[j] == this.chrThuocTinh[i])
                        return true;
            return false;
            
        }
        public void AddTT(BaoDong temp)
        {
            for (int i = 0; i < this.intSoThuocTinh; i++)
            {
                if (this.chrThuocTinh.Contains(temp.chrThuocTinh[i]) == false)
                    add(temp.chrThuocTinh[i]);
            }
        }
        public string ganchuoi()
        {
            string temp = "";
            for (int i = 0; i < this.intSoThuocTinh; i++)
                temp += this.chrThuocTinh[i].ToString();
            return temp;
        }

    }
}
